function Update()
{
	this.doc = {};
	this.options = {};
}
Update.prototype = 
{
	reset : function(field, new_val)
	{
		if (!this.doc["$set"])
		{
			this.doc["$set"] = {};
		}
		this.doc["$set"][field] = new_val;
		return this;
	},
	inc : function(field, inc_val)
	{
		if (!this.doc["$inc"])
		{
			this.doc["$inc"] = {};
		}
		this.doc["$inc"][field] = inc_val;
		return this;
	},
	renameField : function(field, new_name)
	{
		if (!this.doc["$rename"])
		{
			this.doc["$rename"] = {};
		}
		this.doc["$rename"][field] = new_name;
		return this;
	},
	removeField : function(field)
	{
		if (!this.doc["$unset"])
		{
			this.doc["$unset"] = {};
		}
		this.doc["$unset"][field] = "";
		return this;
	},
	setOnInsert : function(insert_field, insert_val)
	{
		if (!this.doc["$setOnInsert"])
		{
			this.doc["$setOnInsert"] = {};
		}
		this.doc["$setOnInsert"][field] = insert_val;
		return this;
	},
	uniquePush : function(field, push_val)
	{
		if (!this.doc["$addToSet"])
		{
			this.doc["$addToSet"] = {};
		}
		this.doc["$addToSet"][field] = push_val;
		return this;
	},
	popFirst : function(field)
	{
		if (!this.doc["$pop"])
		{
			this.doc["$pop"] = {};
		}
		this.doc["$pop"][field] = -1;
		return this;
	},
	popLast : function(field)
	{
		if (!this.doc["$pop"])
		{
			this.doc["$pop"] = {};
		}
		this.doc["$pop"][field] = 1;
		return this;
	},
	pullAll : function(field, vals)
	{
		if (!this.doc["$pullAll"])
		{
			this.doc["$pullAll"] = {};
		}
		this.doc["$pullAll"][field] = vals;
		return this;
	},
	pull : function(field, val)
	{
		if (!this.doc["$push"])
		{
			this.doc["$push"] = {};
		}
		this.doc["$push"][field] = val;
		return this;
	},
	show : function()
	{
		console.log("UPDATE_DOC::")
		console.log(this.doc);
		console.log("UPDATE_OPT::")
		console.log(this.options);
	}
}

exports.Update = Update;